package br.com.hs.biosys.model.domain;

import br.com.hs.biosys.model.domain.generics.GenericDomain;
import javax.persistence.*;

/**
 * Address.class
 *
 * @author Ranlive Hrysyk
 * @since 19/07/2012
 */
@Entity
@Table(name = "\"Address\"")
public class Address extends GenericDomain {

    private static final long serialVersionUID = 1L;
    // *********************** PROPERTIES *********************************** //
    public static final String PROPERTY_ID = "addressID";
    public static final String PROPERTY_STREET = "street";
    public static final String PROPERTY_NUMBER = "number";
    public static final String PROPERTY_NEIGHBORHOOD = "neighborhood";
    public static final String PROPERTY_ZIP_CODE = "zipCode";
    // ********************************************************************** //
    /**
     * ID da entidade. Auto gerado.
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "\"AddressID\"", nullable = false, updatable = false)
    private Long addressID;
    /**
     * Logradouro. Tamanho 30. Não nulo.
     */
    @Column(name = "\"Street\"", nullable = false, length = 30)
    private String street;
    /**
     * Número. Tamanho 6.
     */
    @Column(name = "\"Number\"", length = 6)
    private String number;
    /**
     * Bairro. Tamanho 30.
     */
    @Column(name = "\"Neighborhood\"", length = 30)
    private String neighborhood;
    /**
     * CEP. Tamanho 8.
     */
    @Column(name = "\"ZipCode\"", length = 8)
    private String zipCode;
    /**
     * Município.
     */
    @OneToOne
    @JoinColumn(name = "\"CityID\"")
    private City city;

    /**
     * Constructor default.
     */
    public Address() {
    }

    /**
     * Constructor with identity.
     *
     * @param addressID the id
     */
    public Address(Long addressID) {
        this.addressID = addressID;
    }

    /**
     * ID da entidade. Auto gerado.
     *
     * @return the addressID
     */
    public Long getAddressID() {
        return addressID;
    }

    /**
     * Logradouro. Tamanho 30. Não nulo.
     *
     * @return the street
     */
    public String getStreet() {
        return street;
    }

    /**
     * Logradouro. Tamanho 30. Não nulo.
     *
     * @param street the street to set
     */
    public void setStreet(String street) {
        this.firePropertyChange(PROPERTY_STREET, this.street, this.street = street);
    }

    /**
     * Número. Tamanho 6.
     *
     * @return the number
     */
    public String getNumber() {
        return number;
    }

    /**
     * Número. Tamanho 6.
     *
     * @param number the number to set
     */
    public void setNumber(String number) {
        this.firePropertyChange(PROPERTY_NUMBER, this.number, this.number = number);
    }

    /**
     * Bairro. Tamanho 30.
     *
     * @return the neighborhood
     */
    public String getNeighborhood() {
        return neighborhood;
    }

    /**
     * Bairro. Tamanho 30.
     *
     * @param neighborhood the neighborhood to set
     */
    public void setNeighborhood(String neighborhood) {
        this.firePropertyChange(PROPERTY_NEIGHBORHOOD, this.neighborhood, this.neighborhood = neighborhood);
    }

    /**
     * CEP. Tamanho 8.
     *
     * @return the zipCode
     */
    public String getZipCode() {
        return zipCode;
    }

    /**
     * CEP. Tamanho 8.
     *
     * @param zipCode the zipCode to set
     */
    public void setZipCode(String zipCode) {
        this.firePropertyChange(PROPERTY_ZIP_CODE, this.zipCode, this.zipCode = zipCode);
    }

    /**
     * Município.
     *
     * @return the city
     */
    public City getCity() {
        return city;
    }

    /**
     * Município.
     *
     * @param city the city to set
     */
    public void setCity(City city) {
        this.city = city;
    }
}